<?php
declare(strict_types=1);
namespace Field;

class AigcNavConst
{
    public const pk='';
    public const index=['AigcNavID'];
	public const fields=['AigcNavID','ParentAigcNavID','Name','Icon','IndexRank','IndexShow','TypeID','Link','CreateAt','UpdateAt','Status'];
	public const comment=['AigcNavID'=>'主键','ParentAigcNavID'=>'上级目录','Name'=>'网址目录','Icon'=>'目录图标','IndexRank'=>'首页排序','IndexShow'=>'首页显示','TypeID'=>'类型','Link'=>'链接','CreateAt'=>'','UpdateAt'=>'','Status'=>'状态'];
	/*
    * @Field AigcNavID
    * @Type int(11)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 主键
    */
    public const AigcNavID = 'AigcNavID';
    /*
    * @Field ParentAigcNavID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 上级目录
    */
    public const ParentAigcNavID = 'ParentAigcNavID';
    /*
    * @Field Name
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 网址目录
    */
    public const Name = 'Name';
    /*
    * @Field Icon
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 目录图标
    */
    public const Icon = 'Icon';
    /*
    * @Field IndexRank
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 99
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 首页排序
    */
    public const IndexRank = 'IndexRank';
    /*
    * @Field IndexShow
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 1
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 首页显示
    */
    public const IndexShow = 'IndexShow';
    /*
    * @Field TypeID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 类型
    */
    public const TypeID = 'TypeID';
    /*
    * @Field Link
    * @Type varchar(100)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 链接
    */
    public const Link = 'Link';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field Status
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 状态
    */
    public const Status = 'Status';
}

class AigcNavColumns
{
public  int $AigcNavID;
   public  int $ParentAigcNavID=0;
   public  ?string $Name='';
   public  ?string $Icon='';
   public  int $IndexRank=0;
   public  int $IndexShow=0;
   public  int $TypeID=0;
   public  ?string $Link='';
   public  ?string $CreateAt='';
   public  ?string $UpdateAt='';
   public  int $Status=0;
	public function toArray():array
	{
		return [
'AigcNavID'=>$this->AigcNavID,
    'ParentAigcNavID'=>$this->ParentAigcNavID,
    'Name'=>$this->Name,
    'Icon'=>$this->Icon,
    'IndexRank'=>$this->IndexRank,
    'IndexShow'=>$this->IndexShow,
    'TypeID'=>$this->TypeID,
    'Link'=>$this->Link,
    'CreateAt'=>$this->CreateAt,
    'UpdateAt'=>$this->UpdateAt,
    'Status'=>$this->Status,        ];
	}
}

class AigcNavRow
{
	public AigcNavColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'AigcNavID' => $this->data->AigcNavID,
        'ParentAigcNavID' => $this->data->ParentAigcNavID,
        'Name' => $this->data->Name,
        'Icon' => $this->data->Icon,
        'IndexRank' => $this->data->IndexRank,
        'IndexShow' => $this->data->IndexShow,
        'TypeID' => $this->data->TypeID,
        'Link' => $this->data->Link,
        'CreateAt' => $this->data->CreateAt,
        'UpdateAt' => $this->data->UpdateAt,
        'Status' => $this->data->Status, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AigcNavColumns();
        isset($data['AigcNavID']) && $this->data->AigcNavID = (int)$data['AigcNavID'];
           isset($data['ParentAigcNavID']) && $this->data->ParentAigcNavID = (int)$data['ParentAigcNavID'];
           isset($data['Name']) && $this->data->Name = (string)$data['Name'];
           isset($data['Icon']) && $this->data->Icon = (string)$data['Icon'];
           isset($data['IndexRank']) && $this->data->IndexRank = (int)$data['IndexRank'];
           isset($data['IndexShow']) && $this->data->IndexShow = (int)$data['IndexShow'];
           isset($data['TypeID']) && $this->data->TypeID = (int)$data['TypeID'];
           isset($data['Link']) && $this->data->Link = (string)$data['Link'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
    }
}
?>